#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton* button1 = new QPushButton("按钮1",this);
    QPushButton* button2 = new QPushButton("按钮2",this);
    button2->move(100,100);

    int a = 100;

    connect(button1,&QPushButton::clicked,this,[a]()mutable{a = 200; qDebug()<<a;});
    connect(button2,&QPushButton::clicked,this,[a](){qDebug()<<a;});
}

Widget::~Widget()
{
    delete ui;
}

